<div id="nav" style="display:none;">
  <dl>
    <dt>当前位置：</dt>
    <dd class="link">网址管理</dd>
    <!--导航-->
    <dd class="link">分类列表</dd>
    <!--导航-->
  </dl>
</div>
<script type="text/javascript">
	if ($.browser.msie) {
		document.execCommand("BackgroundImageCache", false, true);
	}
	var nav = document.getElementById("nav");
	var pnav = window.parent.document.getElementById("nav");
	pnav.innerHTML = nav.innerHTML;

</script>
<div class="wrap">
  <div class="container">
    <div id="main">
      <div class="con">
        <div class="table">
          <div class="th">
            <div class="form">
              <div class="fl">
                <input type="button" onclick="window.location='<?php echo Yii::app()->createUrl('UrlClass/create')?>'" value="添加分类" />
                &nbsp;&nbsp;&nbsp;&nbsp; </div>
              <div id="classSearch" class="fl ml5" style="_margin-top:-6px;">
                <input type="text" id="tool_kw" autocomplete="off" onclick="(this.value == '快速搜索分类') ? this.value='' :''" onblur="(this.value == '') ? this.value='快速搜索分类' :''" onmouseover="this.select()" value="快速搜索分类" class="textinput gray9 w270 mt5" />
              </div>
            </div>
          </div>
          <form action='<?php echo Yii::app()->createUrl('UrlClass/MultipleUpdate')?>' method='post'>
            <table class="admin-tb" id="datatable">
              <thead>
                <tr>
                  <th width="41" class="text-center">选择</th>
                  <th width="200">排序</th>
                  <th >分类名称</th>
                  <th width="200">分类path</th>
                  <th  width="80">站点数量</th>
                  <th width="161">操作</th>
                </tr>
              </thead>              
              <?php $this->widget('zii.widgets.CListView', array(
					'dataProvider'=>$dataProvider,
					'itemView'=>'_classview',
					'template'=>"{items}",
				)); ?>
            </table>
            <div class="th">
              <div class="form">
                <input type='hidden' name='commit' value='1' />
                <input type='radio' name='action' value='del' />
                删除
                <input type='radio' name='action' value='update' checked />
                其他更改
                <input type="submit" value="保存" />
                &nbsp;
                &nbsp; </div>
            </div>
          </form>
        </div>
      </div>
      <!--/ con-->
    </div>
  </div>
  <!--/ container-->
  
</div>
<!--/ wrap-->
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl;?>/assets/js/catgorymanager.js"></script>
<script type="text/javascript">
    CatgoryManager.AjaxUrl = "<?php echo Yii::app()->createUrl('UrlClass/ajaxgetlist',array('parentid'=>''));?>";
	CatgoryManager.SetDisplayFun(function(data,parentNode,childIndex){
		var pexyText = "├-";
		for(var i = 0; i < childIndex; i++){
			pexyText = "&nbsp;&nbsp;&nbsp;&nbsp;" + pexyText;
		}
		childIndex = Number(childIndex) + 1;
		var html = "";
		for(var key in data){
			var item = data[key];
			html += '<tr sitenum="'+item["sitenum"]+'" classnum="'+item["sub_classnum"]+'" sub_sitenum="'+item["sub_sitenum"]+'" classid="'+item["classid"]+'" childindex="'+childIndex+'" parent="'+parentNode.attr("classid")+'">';
			html += '<td class="text-center"><input name="rmid['+item["classid"]+']" type="checkbox" rel="del"  /></td>';
			html += '<td>'+pexyText+'<input name="order[]" type="text" id="order[]" class="textinput" tabindex="11" value="'+item["displayorder"]+'" size="4" />';
			html += '<input name="orderid[]" type="hidden" id="orderid[]" value="'+item["classid"]+'" /></td>';
			if(Number(item["sitenum"]) > 0){
				var classNameText = item["classname"];
				if(Number(item["sub_classnum"]) > 0){
					classNameText = '<a href="javascript://">' + classNameText + '</a>';
				}
				html += '<td rel="classname">' + pexyText + classNameText + ' <a rel="sites" href="?c=site_manage&classid='+item["classid"]+'" style="color:red;">[列表]</a></td>';
			}
			else{
				html += '<td rel="classname">' + pexyText + '<a href="javascript://">' + item["classname"]+'</a></td>';
			}
			
			html += '<td><input name="path['+item["classid"]+']" type="text" class="textinput" style="width: 200px;" id="path['+item["classid"]+']" value="'+item["path"]+'" /></td>';
			html += '<td>'+ (item["sitenum"] == 0? (item["sub_sitenum"] || 0 ) : item["sitenum"])+'</td>';
			html += '<td>[<a href="admin.php?r=UrlClass/update&id='+item["classid"]+'&classid=&path='+item["path"]+'">修改</a>] &nbsp; </td>';
			html += '</tr>';
		}
		//alert(html);
		var col = $(html);
		col.find("td[rel='classname'] a").not("[rel='sites']").each(function(i){
			CatgoryManager._bindEvent($(this));
		});
		parentNode.after(col);
		return col;
	});
	CatgoryManager.Init($("#datatable"));
</script>
<div id="js_search_msg" class="js_search_msg" style="display:none;"></div>
<style type="text/css">
	.js_search_msg{ position:absolute; background:#fff; border:1px solid #CEDEAE;}
	.js_search_msg li{ padding:3px 5px; cursor:pointer;}
	.js_search_msg li.active{ background:#EBF4D8}
</style>
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl;?>/assets/js/textboxdrop.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$(".admin-tb").find("input[rel='del']").each(function(i){
			$(this).bind("click",function(){
				$(".admin-tb").find("input[rel='del']").each(function(i){
					var tr = $(this).parent().parent();
					if(this.checked){
						tr.addClass("checked");
					}
					else{
						tr.removeClass("checked");
					}
				})
				
			})
		});
		
		var t = new TextBoxDrop("tool_kw","js_search_msg");
		t.SetEnterHandler (function(ele){
							CatgoryManager.SelectClass($(ele).attr("rel"));
					});
		t.DefaultKey = "id_list";
		t.SetAjaxMethod($.get);
		t.Url('<?php echo Yii::app()->createUrl('UrlClass/search',array('k'=>''));?>');
		t.SetContentStyle(function(intput,contentbox){
			var inputBox = $(intput);
			if($.browser.ie){
				contentbox.style.left = inputBox.offset().left;
				contentbox.style.top = inputBox.offset().top + 23;
			}
			else{
				$(contentbox).css({
					top : inputBox.offset().top + 23,
					left: inputBox.offset().left
				});
			}
		});
		t.DisplayContentHandler(function(input,contentbox){
			if($(contentbox).width() < $(input).outerWidth()){
				$(contentbox).width($(input).outerWidth());
			}
		});
	});
</script>
<p style="text-align:center;padding:15px;color:#6B7355;
font-family:Verdana;
font-size:12px;"> Powered by <a href="http://www.ylmf.com" target="_blank"> <b>雨林木风</b></a> &copy; 2009 <a href="http://www.114la.com" target="_blank"> <b>114la.com</b></A><a href="http://www.ylmf.com" target="_blank"></a> </p>
